// Compass.h
//
#ifndef COMPASS_H
#define COMPASS_H

#include <QImage>
#include "GUIElement.h"

namespace IDS {
namespace IDEAS {
namespace OpenGLView {
namespace GUIElements {

class Compass : public GUIElement
{
private:
	int width, height;
	QImage textureBase;
	QImage textureAux;
	double angleTrueNorth;
	double angleMagneticNorth;

	QPointF currPos;
	QPointF startPos;
	bool dragging;

	virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
	virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
	virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
	virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
	virtual void wheelEvent(QGraphicsSceneWheelEvent *event);

public:
	Compass(int x, int y, int w, int h);
	~Compass();

	QRectF boundingRect() const;
	void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *);

	void setAngles(double trueNorth,double magneticNorth)
	{
		//CONSOLE_LOG("North: %.2f\n\n",degrees)
		angleTrueNorth		= trueNorth;
		angleMagneticNorth	= magneticNorth;
	}

	bool isDragging()
	{
		return dragging;
	}
};

}}}}
#endif